<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //Math.round()  四舍五入操作最终保留到整数
    var resault1=Math.round(1.3);
    console.log(resault1);
    resault1=Math.round(1.73);
    console.log(resault1);

    //保留一位小数操作，其他同理
    var num = 2.16;
    num=num*10;
    var resault2=Math.round(num);
    resault2=resault2/10;
    console.log(resault2);

    //向下取整Math.floor()   向上取整Math.ceil()
    var resault3=Math.floor(1.6);
    var resault4=Math.ceil(1.3);
    console.log(resault3,resault4);
</script>
</html>